<template>
	<view class="wrap">
		<view class="img">
			<u-image :src="res.urls[0]" mode="aspectFill" height="400"></u-image>
		</view>
		<view class="title">
			<view class="text">
				<view>{{res.c_content}}</view>
			</view>
			<view class="icon">
				<u-icon name="map"></u-icon>{{res.c_faceplace}}
				<u-icon style="margin-left: 20rpx;" name="home"></u-icon>{{res.c_type}}
			</view>
		</view>
		<u-line color="#eeeeee" />
		<view class="tags">
			<view class="text">适合主题</view>
			<view class="tip">
				<u-tag style="margin-right: 15rpx;" v-for="(inss,indess) in res.c_tags" class="tag" shape="circle" :text="inss"
				 mode="plain" />
			</view>
		</view>
		<u-line color="#eeeeee" />
		<view class="user">
			<view class="text">推荐人</view>
			<view class="info" @click="userinfo(res.c_id)">
				<view class="left">
					<u-avatar size="80" :src="res.c_ava"></u-avatar>
				</view>
				<view class="right">
					<view class="top">
						<view class="name" style="margin: 12rpx;">{{res.c_name}}
							<u-icon size="30" name="../../../static/boy.png"></u-icon>
						</view>
					</view>
				</view>
			</view>
		</view>
		<u-line color="#eeeeee" />
		<view class="introduce">
			<view class="text">场地描述</view>
			<view>
				<text style="color: gray;">{{res.c_introduce}}</text>
			</view>
		</view>
		<u-line color="#eeeeee" />
		<view class="traffic">
			<view class="text">地址与交通</view>
			<view style="margin-bottom: 15rpx;">
				<text style="color: gray;">{{res.c_traffic}}</text>
			</view>
			<view>
				<u-image @click="previewImage(index1,res.urls)" v-for="(res1,index1) in res.urls" :src="res1" mode="widthFix"></u-image>
			</view>
		</view>
		<view class="time">
			<view>{{res.pub_date}}</view>
			<view>
				<u-icon name="eye"></u-icon>{{res.view}}
			</view>
		</view>
	</view>

</template>

<script>
	import api from '@/api/api.js'
	export default {
		data() {
			return {
				id: '',
				res: [],
			}
		},
		onLoad(res) {

			this.id = res.id
			//console.log(this.id)
			this.get();
		},
		onShow() {
			uni.request({
				url: api.baseUrl+'/users/placeview',
				method: 'GET',
				data: {
					id: this.id
				}
			})
		},
		methods: {
			userinfo(res) {
				
				uni.navigateTo({
					url: '../../user/userinfo/userinfo?u_id=' + res
				})
			},
			previewImage(current, photos) {
				uni.previewImage({
					current,
					urls: photos
				})
			},
			get() {
				uni.request({
					url:api.baseUrl+ '/users/placedetail',
					method: 'GET',
					data: {
						id: this.id
					},
					success: (res) => {
						this.res = res.data[0]
					}
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.wrap {
		height: 100%;
	}

	.title {
		display: flex;
		justify-content: space-between;
		//border: 1px solid lightcoral;
		padding: 20rpx;

		.text {
			font-size: 30rpx;
		}
	}

	.tags {
		padding: 20rpx;
		//border: 1px solid lightcoral;

		.text {
			margin-bottom: 15rpx;
		}
	}

	.user {
		padding: 20rpx;
		//border: 1px solid lightcoral;

		.text {
			margin-bottom: 15rpx;
		}

		.info {
			display: flex;
			width: fit-content;
		}
	}

	.introduce {
		padding: 20rpx;

		.text {
			margin-bottom: 15rpx;
		}
	}

	.traffic {
		padding: 20rpx;
		//margin-bottom: 70rpx;

		.text {
			margin-bottom: 15rpx;
		}
	}

	.btn {
		display: flex;
		justify-content: space-around;
		height: 80rpx;
		width: 100%;
		bottom: 0;
		position: fixed;
		background: lightsteelblue;

		.btns {
			margin-top: 1.5vh;
		}
	}

	.time {
		display: flex;
		align-items: center;
		justify-content: space-between;
		margin-left: 20rpx;
		margin-right: 20rpx;
		margin-bottom: 5vh;
	}
</style>
